/*
 * @lc app=leetcode.cn id=409 lang=javascript
 *
 * [409] 最长回文串
 */

// @lc code=start
/**
 * @param {string} s
 * @return {number}
 */
var longestPalindrome = function(s) {
    let obj = {}
    let result = 0
    for (let index = 0; index < s.length; index++) {
        const element = s[index];
        if (!obj[element]) {
            obj[element] = 1
        } else {
            delete obj[element]
            result += 2
        }
    }
    if (Object.keys(obj).length !== 0) {
        result += 1
    }
    return result
};
// @lc code=end

